﻿@{
    ViewBag.Title = "CouponInfo";
}
@section scripts
{
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <link href="~/Scripts/miniui/themes/default/medium-mode.css" rel="stylesheet" type="text/css" />      
}

<form id="form1" method="post">
    <div class="mini-toolbar" style="padding:2px;border-top:0;border-left:0;border-right:0;"> 
        <table style="width:100%;">
            <tr>
                <td style="width:100%;">
                    <a class="mini-button" name="SaveInfo" iconCls="icon-save" onclick="SaveInfo" plain="true">保存并审核</a>
                    <a class="mini-button" iconCls="icon-close" onclick="CloseWindow" plain="true">关闭</a>
                </td>
            </tr>
        </table>                
    </div>
    <div name="Base" title="提现申请" style="height:100%;overflow:hidden;margin-left:20px; margin-top:15px;">
        <table >
            <tr>
                <td width="80px" height ="35px" align="right">
                    申请单号：</td>
                <td width="200px" height ="35px">
                    <input name="FBillNo" class="mini-textbox" readonly="readonly" style="width:190px;"/>
                </td>
                <td width="80px" height ="35px" align="right">
                    申请日期：</td>
                <td width="200px" height ="35px">
                    <input class="mini-datepicker" name="FDate" format="yyyy-MM-dd HH:mm:ss" 
                        timeFormat="HH:mm:ss" showTime="true" style="width:190px;" value = "" readonly="readonly"/>
                </td>
            </tr>
            <tr>
                <td width="80px" height ="35px" align="right">
                    开户行：</td>
                <td width="200px" height ="35px">
                    <input name="FBankName" class="mini-textbox" readonly="readonly"style="width:190px;"/>
                </td>
                <td width="80px" height ="35px" align="right">
                    银行帐号：</td>
                <td width="200px" height ="35px">
                    <input name="FBankNo" class="mini-textbox"readonly="readonly"style="width:190px;"/>
                </td>
            </tr>
            <tr>
                <td width="80px" height ="35px" align="right">
                    收款人：</td>
                <td width="200px" height ="35px">
                    <input name="FBankUser" class="mini-textbox" readonly="readonly"style="width:190px;"/>
                </td>
                <td width="80px" height ="35px" align="right">
                    帐户余额：</td>
                <td width="200px" height ="35px">
                    <input id="FRebateAmount" name="FRebateAmount" class="mini-spinner" changeOnMousewheel ="false" readonly="readonly" minValue="0" maxValue="99999999"
                        required="true" style="width:190px;" showbutton="false"  numberFormat="#,0.00" align="right"/>  
                </td>
            </tr>
            <tr>
                <td width="80px" height ="35px" align="right">
                    申请金额：</td>
                <td width="200px" height ="35px">
                    <input id="FAmount" name="FAmount" class="mini-spinner" changeOnMousewheel ="false" readonly="readonly" minValue="0" maxValue="99999999"
                        required="true" style="width:190px;" showbutton="false"  numberFormat="#,0.00" align="right"/>  
                </td>
                <td width="80px" height ="35px" align="right">
                    转帐金额：</td>
                <td width="200px" height ="35px">
                    <input id="FCheckAmount" name="FCheckAmount" class="mini-spinner" changeOnMousewheel ="false" minValue="0" maxValue="99999999" 
                        required="true" style="width:190px;" showbutton="false"  numberFormat="#,0.00" align="right"/>  
                </td>
            </tr>
            <tr>
                <td width="80px" height ="35px" align="right">
                    店铺名称：</td>
                <td width="200px" height ="35px">
                    <input id="FName" name="FName" class="mini-textbox " style="width:190px;"/>
                </td>
                <td width="80px" height ="35px" align="right">
                    联系电话：</td>
                <td width="200px" height ="35px">
                    <input name="FTelephone" class="mini-textbox" readonly="readonly"style="width:190px;"/>
                </td>
            </tr>
        </table>
        <table >
            <tr>
                <td width="80px" height ="35px" align="right">
                    摘要：</td>
                <td width="500px" height ="35px">
                    <input id="FExplanation" name="FExplanation" class="mini-textbox " style="width:480px;"/>
                </td>
            </tr>
        </table>
    </div>
    <input name="KInterID" class="mini-hidden" />
    <input name="FCheckFlag" class="mini-hidden" />
    <script type="text/javascript">
        //通用shown自动调用些方式
        function FormShown() {
            mini.parse();
        }

        //加载资料
        function SetInfoData(data) {
            mini.getbyName("FRebateAmount").setEnabled(false);
            mini.getbyName("FAmount").setEnabled(false);
            $.post("GetWithdrawInfo", { mydata: "[{'KInterID':'" + data.KInterID + "','mSystemAppID':'" + parent.window.getSystemAppID() + "'}]" }, function (data) {
                var form = new mini.Form("form1");
                var mdata = mini.decode(data);
                form.setData(mdata.data[0]);
                if (mini.getbyName("FCheckFlag").getValue() == true)
                {
                    mini.getbyName("SaveInfo").setEnabled(false);
                    mini.getbyName("FCheckAmount").setEnabled(false);
                }
            });
        }        

        //保存资料
        function SaveInfo() {
            var mFAmount = mini.getbyName("FAmount").getValue();
            var mFCheckAmount = mini.getbyName("FCheckAmount").getValue();
            var mKInterID = mini.getbyName("KInterID").getValue();

            if (mFCheckAmount > mFAmount)
            {
                mini.alert("转帐金额不能大于申请金额.");
                return;
            }

            var mdata = "[{'KInterID':'" + mKInterID + "','FCheckAmount':'" + mFCheckAmount + "','mSystemAppID':'" + parent.window.getSystemAppID() + "'}]";

            $.post("SaveWithdrawInfo", { mydata: mdata }, function (data) {
                var ret = mini.decode(data);
                if (ret.status == 1) {
                    mini.showTips({ content: ret.msg, state: "success", x: "center", y: "top", timeout: 3000 });
                    mini.getbyName("SaveInfo").setEnabled(false);
                    mini.getbyName("FCheckAmount").setEnabled(false);
                }
                else {
                    mini.alert("异常:" + ret.error);
                }
            });
        }        
    </script>
</form>
